﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SmsTaskLog.aspx.cs" Inherits="JKF.Web.SMS.SmsTaskLog" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <%= RegScript("~/js/jquery.1.5.js")%>
    <%= RegScript("~/js/jquery.nhis.js")%>
    <%= RegScript("~/js/jquery.rchis.js")%>
    <%= RegScript("~/js/jquery-ui-custom.min.js")%>
    <%=RegScript("~/js/jquery.json.js")%>
    <%= RegScript("~/js/css.js")%>
    <%= RegScript("~/js/DatePicker/WdatePicker.js")%>
    <%=RegScript("~/js/jquery.validate.js")%>
    <%= RegScript("~/js/Common.js")%>
    <%= RegScript("~/js/Jquery.commonGrid.js")%>
    <%=this.RegStyle("~/App_Themes/Theme2/Include.css")%>
    <script type="text/javascript">
        var AppPath = '<%=AppPath %>';
        var handler = AppPath + '/do/SMS/SmsModule.do';
        var tmpl = new DTemplate();
        var taskKey = "<%=P("taskKey")%>";
        var PageSize = 20;
        var pager = null;
        var advSearch = null;
        var rowTemplate = "<tr><td>${CONTENT}</td><td>${DATA_CREATE}</td><td>${SMS_COUNT}</td></tr>";
        var dtReg = /^\d{4}(\/|-)([1][0-2]|[1-9]|0[1-9])(\/|-)([1-2][0-9]|3[0-1]|[1-9]|0[1-9])( (0?[0-9]|1[0-9]|2[0-4])(:([0-5][0-9])){1,2})?$/;
        $(function () {
            pager = $('#divPager').pager(AppPath, handler, function () {
                return {
                    ActionName: 'GetSmsTaskLog',
                    taskKey: $.FxNull(taskKey, ""),
                    dateStart: $.trim($("#dateStart").val()),
                    dateEnd: $.trim($("#dateEnd").val())
                };
            }, function (data) {
                var tbody = $('#tb tbody');
                tbody.empty();
                if (data && data.Entity && data.Entity.length) {
                    tbody.html(tmpl(rowTemplate, data.Entity, true));
                } else {
                    tbody.html('<tr><td colspan="3" style="text-align: center">没有数据!</td></tr>');
                }
                $("#tb").H8_Grid($("#divPager"), (function () { var tbHeight = $(window).height() - 35; tbHeight -= ($(".common_search").size() > 0) ? $(".common_search").eq(0).height() : 0; tbHeight -= ($("#divPager").size() > 0) ? $("#divPager").height() : 0; return tbHeight < 300 ? 300 : tbHeight; })());
            }, PageSize, true);

            $('#btnSearch').click(function () {
                if (!$.validateAll()) {
                    if ($(".alxv-failed").size() > 0) {
                        $(document).scrollTop($(".alxv-failed").eq(0).scrollTop());
                    }
                    return;
                };
                pager.option.pageIndex = 1;
                pager.getPegerData();
                return false;
            });

            alxVr.push({
                id: "dateStart",
                rule: function (cn) {
                    var vl = $.trim(cn.val());
                    if (vl != "") {
                        if (!dtReg.test(vl)) {
                            this.msg = "执行时间最小值不正确，应为日期（如:2012-1-1）.";
                            return false;
                        }
                    }
                    return true;
                }
            });
            alxVr.push({
                id: "dateEnd",
                rule: function (cn) {
                    var vl = $.trim(cn.val());
                    if (vl != "") {
                        if (!dtReg.test(vl)) {
                            this.msg = "执行时间最大值不正确，应为日期（如:2012-1-1）.";
                            return false;
                        }
                        var min = $.trim($("#dateStart").val());
                        if (dtReg.test(min) && !dateCompare(min, vl)) {
                            this.msg = "执行时间最大值应大于等于执行时间最小值.";
                            return false;
                        }
                    }
                    return true;
                }
            });
            $.validateBind();
        });
    </script>
</head>
<body>
    <form id="form1" runat="server">
        <div class="warrper_body">
            <div class="index">
                <div class="common_search">
                    <div class="l_h45">
                        <span class="mb20 mr30" style="display: inline-block; text-align: right;">执行时间：
                            <input type="text" id="dateStart" class="common_search_input w150" onfocus="WdatePicker()" />
                        </span>
                        <span class="mb20 mr30" style="display: inline-block; text-align: right;">至
                            <input type="text" id="dateEnd" class="common_search_input w150" onfocus="WdatePicker()" />
                        </span>
                        <input type="button" class="common_btn_search" id="btnSearch" />
                    </div>
                </div>
                <div class="l_h7"></div>
                <div class="index_table">
                    <table id="tb" class="common_table">
                        <thead>
                            <tr>
                                <th width="200px" orderaction="false">发送内容
                                </th>
                                <th width="100px" ordertype="string">执行时间
                                </th>
                                <th width="150px" ordertype="string">发送数量
                                </th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td colspan="3" style="text-align: center">点击搜索查看数据
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </div>
                <div class="page" id="divPager">
                </div>
            </div>
        </div>
    </form>
</body>
</html>
